﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminMaster.master" AutoEventWireup="true" CodeBehind="Services.aspx.cs" Inherits="doris.Admin.Services" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:localConnectionString %>" 
        DeleteCommand="deleteService" DeleteCommandType="StoredProcedure" 
        InsertCommand="addService" InsertCommandType="StoredProcedure" 
        ProviderName="<%$ ConnectionStrings:localConnectionString.ProviderName %>" 
        SelectCommand="getAllServices" SelectCommandType="StoredProcedure" 
        UpdateCommand="storeService" UpdateCommandType="StoredProcedure" 
        ondeleting="SqlDataSource1_Deleting">
        <DeleteParameters>
            <asp:Parameter Name="in_serviceid" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="in_service" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="in_serviceid" Type="Int32" />
            <asp:Parameter Name="in_service" Type="String" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" 
        AutoGenerateColumns="False" DataKeyNames="SerivceID" CssClass="dorisGrid" AlternatingRowStyle-CssClass="alt">
<AlternatingRowStyle CssClass="alt"></AlternatingRowStyle>
        <Columns>
            <asp:CommandField ShowDeleteButton="true" />
            <asp:BoundField DataField="SerivceID" HeaderText="SerivceID" 
                InsertVisible="False" ReadOnly="True" SortExpression="SerivceID" 
                Visible="False" />
            <asp:TemplateField HeaderText="Service" SortExpression="Service">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Service") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# "Service.aspx?id=" + Eval("SerivceID") %>'><asp:Label ID="Label2" runat="server" Text='<%# Bind("Service") %>'></asp:Label></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>        
        <EmptyDataTemplate>
            Ingen firma
        </EmptyDataTemplate>        
    </asp:GridView>
    <asp:HyperLink ID="HyperLink1" runat="server" 
        NavigateUrl="~/Admin/Service.aspx">Legg til ny</asp:HyperLink>
    <p><asp:HyperLink ID="HyperLink3" runat="server" 
        NavigateUrl="~/Admin/ServiceAgreements.aspx">Tilbake</asp:HyperLink></p>
</asp:Content>
